MarkerSkiny = createMarker(771.72, -573.61, 16.25-1, "cylinder", 2, 100, 0, 255, 70)

local vehicles = {
    "445",
    "429",
    "424",
    "496",
    "422",
    "541",
    "415",
    "542",
    "589",
    "579",
    "400",
    "500",
    "418",
    "516",
    "404",
    "458",
    "439",
    "506",
    "566",
    "549",
    "576",
    "451",
    "540",
    "478",
    "529",
    "555",
    "477",
    "600",
    "558",
    "527",
    "543",
    "554",
    "565",
    "474",
    "545",
    "410",
    "495",
    "423",
}


function hit(el,md)
    if not md or getElementType(el) ~= "player" then return end
    if not isPedInVehicle(el) then return end
    if not getElementData(getPedOccupiedVehicle(el),"vehicle:data").id then return end
    for i,v in pairs(vehicles) do
    if tonumber(v) == getElementModel(getPedOccupiedVehicle(el)) then
    triggerClientEvent(el,'paintjobs:showGUI',resourceRoot)
    end
end
end
addEventHandler( "onMarkerHit", MarkerSkiny, hit)

function leave(el,md)
    if not md or getElementType(el) ~= "player" then return end
    if not isPedInVehicle(el) then return end
    triggerClientEvent(el,'paintjobs:hideGUI',resourceRoot)
end
addEventHandler( "onMarkerLeave", MarkerSkiny, leave)

addEvent("paintjobs:buy", true)
addEventHandler("paintjobs:buy", resourceRoot, function(veh,id)
local result=exports["cmta-db"]:dbSet("UPDATE cmta_pojazdy SET shader=? WHERE id=?", id, getElementData(veh,"vehicle:id"))
local data = getElementData(veh,"vehicle:data")
data.shader = id
setElementData(veh,"vehicle:data",data)
local data = getElementData(client,"player:data")
data.points = data.points-18500
setElementData(client,"player:data",data)
triggerClientEvent(root, "paintjobs:addtexture", resourceRoot,veh,id)
end)